<?php
	namespace app\controller\admin;
	// use app\model\Appid;
	use think\Response;
	use think\Model;
	class AppidService extends Model
	{
		protected $name = 'appid';
		// protected $Appid;
		
		    // public function __construct()
		    // {
		    //     $this->jjAppidModel = new Appid();
		    // }
			
		 // 获取所有记录
			public function getRecord($id)
			{
				$res = $this->select();
				
				return success($res);
			}
			
			public function getRecordsByPage($page = 1, $limit = 2)
			{
				// $res = $this->page($page, $limit)->select();
				$res = $this->get_list('ios_pay=1',$page,$limit,'id ASC','id,appid');
			    return success($res);
			}
			
			public function get_list($where,$page,$limit,$order,$field){
				$list = $this->where($where)->order($order)->paginate(['page'=>$page,'list_rows'=>$limit]);
				// dump($list);
				return [
					"currentPage" => $list->currentPage(),
					"lastPage" => $list->lastPage(),
					"list" => $list->items(),
					"count" => $list->total()
				];
			}
	}
	